﻿using WpfAi.Vm;
using WpfAi.Enum;
using Brilliants.UI;
using System.Windows.Input;
using System.Windows.Media;

namespace WpfAi
{
    /// <summary>
    /// MainWindow.xaml 的交互逻辑
    /// </summary>
    public partial class MainWindow : NbWindow
    {
        public MainWindow(EnumWindowType windowType, EnumBoardType boardType)
        {
            InitializeComponent();
            this.DataContext = new MainWindowVm(windowType, boardType);
        }
        private void imgInPic_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            if (e.ClickCount >= 1)
            {
                //ShowPhoto(imgInPic.Source);
            }
        }
        private void ShowPhoto(ImageSource source)
        {
            Photo o = new Photo(source);
            o.Owner = this;
            o.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
            o.ShowDialog();
        }
        private void NbWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            GlobalEnvironment.Serial.closePort();
            ChoiceWindow choiceWindow = new ChoiceWindow();
            choiceWindow.Show();
        }
    }
}
